package utils

import (
	"encoding/json"

	"github.com/gin-gonic/gin"
)

func JSONNoEscape(c *gin.Context, code int, obj interface{}) {
	c.Status(code)
	c.Writer.Header().Set("Content-Type", "application/json; charset=utf-8")
	enc := json.NewEncoder(c.Writer)
	enc.SetEscapeHTML(false)
	if err := enc.Encode(obj); err != nil {
		panic(err)
	}
}
